package cn.edu.zafu.bigdata.smj.a;

public class Divide {
    public static double divide(int a,int b){
        if(b==0){
            throw new ArithmeticException("除数不能为0!");
        }
        return (double)a/b;
    }
    public static void main(String[] args) {
        try{
            int result = (int)divide(10,0);
            System.out.println("结果是: " + result);
        }catch (ArithmeticException e){
            System.out.println("错误: " + e.getMessage());
        }
    }
}
